//
//  SelectImageCell.m
//  LazyCat
//
//  Created by Abner on 16/9/24.
//  Copyright © 2016年 zhanshu. All rights reserved.
//

#import "SelectImageCell.h"
#import "UIImageView+WebCache.h"
@implementation SelectImageCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSelectImageCellUI];
    }
    return self;
}
-(void)creatSelectImageCellUI
{
    CGFloat imgWidth = (ScreenWidth-40)/3;
    
    self.productImgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, imgWidth, imgWidth)];
    [self.contentView addSubview:self.productImgV];
    self.productImgV.contentMode = UIViewContentModeScaleToFill;
    
    self.statusImgV = [[UIImageView alloc]initWithFrame:CGRectMake(imgWidth-27, 5, 22, 22)];
    [self.contentView addSubview:self.statusImgV];
    self.statusImgV.contentMode = UIViewContentModeScaleToFill;
}
-(void)setupStatusImg:(BOOL)isClicked
{
    if (isClicked) {
        self.statusImgV.image = [UIImage imageNamed:@"select_pic_cur"];
    }else{
        self.statusImgV.image = [UIImage imageNamed:@"select_pic"];
    }
}
-(void)setupSelectImageCellData:(NSString *)imgUrl img:(UIImage *)img
{
    
    if (img) {
        self.productImgV.image = img;
    }else{
       [self.productImgV sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"product-no-pic"]]; 
    }
}
@end
